from application import app, db
# from application import scheduler
from www import *
from flask.cli import AppGroup
from jobs.movie import runjob
import datetime
import click


# from common.models.user import User

# @Command
# def create_all():
#     db.create_all()


def aps_test():
    print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))


# movie = AppGroup("user")
# app.cli.add_command(movie)
app.cli.add_command(runjob)


@app.cli.command()
def run():
    app.apscheduler.add_job(func=aps_test, trigger="cron", second="*/5", id="aps_test", timezone='Asia/Shanghai')
    # scheduler.start()
    app.run()
